class Member:
    def __init__(self, level, discount_rate):
        self.level = level
        self.discount_rate = discount_rate

class CartItem:
    def __init__(self, name, price, quantity, member=None):
        self.name = name
        self.price = price
        self.quantity = quantity
        self.member = member

    def calculate_price(self):
        if self.member:
            discount = (self.price * self.quantity) * (1 - self.member.discount_rate)
            return self.price * self.quantity - discount
        else:
            return self.price * self.quantity

class ShoppingCart:
    def __init__(self):
        self.items = []

    def add_item(self, item):
        self.items.append(item)

    def apply_discount(self):
        total = sum(item.calculate_price() for item in self.items)
        return total

    def show(self):
        for item in self.items:
            print(f"{item.name} - 单价: {item.price}, 数量: {item.quantity}")
            if item.member:
                print(f"会员等级: {item.member.level}, 折扣率: {item.member.discount_rate}, 折扣后总价: {item.calculate_price()}")
            else:
                print(f"总价: {item.calculate_price()}")
        print(f"购物车总价: {self.apply_discount()}")

member1 = Member(1, 0.1)  # 会员等级1，10%折扣
member2 = Member(2, 0.2)  # 会员等级2，20%折扣

cart = ShoppingCart()
cart.add_item(CartItem("苹果", 10, 5, member1))
cart.add_item(CartItem("香蕉", 5, 10, member2))
cart.add_item(CartItem("橙子", 8, 3))

cart.show()